<?php


namespace App\Controller\Admin;


use App\Controller\AbstractController;
use App\Request\Admin\NotificationIndexRequest;
use App\Request\Admin\NotificationReadRequest;
use App\Service\Admin\NotificationService;
use Hyperf\Di\Annotation\Inject;

class NotificationController extends AbstractController
{

    /**
     * @Inject()
     * @var NotificationService
     */
    protected $notificationService;

    public function index(NotificationIndexRequest $request)
    {
        $validated = $request->validated();
        $index = $this->notificationService->index($validated);
        return $this->response->success($index);
    }

    public function read(NotificationReadRequest $request)
    {
        $validated = $request->validated();
        $this->notificationService->read($validated['ids']);
        return $this->response->success();
    }
}